<template>
    <router-link style="display:flex; justify-content:flex-end " to="/my-cart">
        <el-badge style="width: 101px;" :value="ShoppingCartNum">
                <el-button size="medium" type="danger">
                    <i class="fa fa-shopping-cart"></i>购物车
                </el-button>
        </el-badge>
    </router-link>

</template>

<script>
// import axios from "axios"
import http from "../core/HttpRequest"
export default {
    data() {
        return {
            ShoppingCartNum: 0
        }
    },
    mounted: function() {
        http.get("/shoppingCart/count",{
            params:{
                userName: this.$cookies.get("username")
            }
        }).then(res => {
            this.ShoppingCartNum = res.data.data
        })
    }
}
</script>

<style scoped>
</style>